#pragma once

class MonthData:
	public DetailList //onliy unqualified data stored
{
public:
	string customer;//workshop, -> material,
	string material;//
	string test_item_newname; //other pattern
	string test_item;
	string material_no;
	int count_all;
	int count_unqualified;
	float percent_qualified[12]; //month by month
	int count_all_months[12];
	int count_unqualified_months[12];
	//DetailList uq_dl;

	MonthData(void);
	~MonthData(void);
};

typedef list<MonthData *> MonthDataList;

class AnaMonth
{
public:
	AnaMonth(RootDetailList *root_detail_list);
	AnaMonth(void);
	~AnaMonth(void);

private:
	RootDetailList *root_detail_list;
	MonthDataList mon_dl_powder_workshop[12];
	MonthDataList mon_dl_alloy_workshop[12];
	MonthDataList mon_dl_rivet_workshop[12];
	MonthDataList mon_dl_supply_department[12];
	MonthDataList all_month_data;
public:
	int AnalyzeMonth(int month);
	int AnaDetail(Detail *detail, MonthDataList &mon_dl, int month);
	int Analyze(int month);
	BOOL OutputExcel(int month);

	MonthData * FindMonthData(MonthData * my_month_data, MonthDataList &mon_dl);
	MonthData * FindMonthData(Detail * detail, MonthDataList &mon_dl);
	int GetOtherUnqualified(int month);
	void CustomerOutputExcel(IllusionExcelFile & excel, MonthDataList & mon_dl, char * customer_name, int month);
	void SetRootDetailList(RootDetailList *root_detail_list);
	void FreeAllMonthData(void);
};

#define RESULT_MONTH_FILENAME "result-month.xlsx"
